import React from 'react';
import { StyleSheet } from 'react-native';
import { Container } from '@/rcomponents';
import { List } from '@ant-design/react-native';
import UserStore from '@/stores/userStore';
import AerialMaterialMovement from './materialMovement';
import NoninstructShipPage from './nonInstructShip';
import MaterialReturnedPage from './materialReturn';
import InstructShipPage from './instructShip';
import { WhseManagementHomeRoute } from './routeDef';

const styles = StyleSheet.create({
  verticallist: {
    marginTop: 25,
  },
});

const AerialMaterialWarehouseIndex = ({ navigation }) => {
  const userStore = UserStore.useStore();
  return (
    <Container>
      <List renderHeader="发料">
        {userStore.hasPermission('InstructShipUnimplemented') && (
          <List.Item
            arrow="horizontal"
            onPressIn={() => {
              navigation.navigate(InstructShipPage.routeName);
            }}
          >
            有指令发料
          </List.Item>
        )}
        {userStore.hasPermission(NoninstructShipPage.permission) && (
          <List.Item
            arrow="horizontal"
            onPress={() => {
              navigation.navigate(NoninstructShipPage.routeName);
            }}
          >
            无指令发料
          </List.Item>
        )}
        {userStore.hasPermission('MaterialPrepareUnimplemented') && (
          <List.Item arrow="up" onPress={() => {}}>
            发料准备
          </List.Item>
        )}
      </List>
      <List style={styles.verticallist}>
        {userStore.hasPermission('ReturnedMaterialUnimplemented') && (
          <List.Item
            arrow="horizontal"
            onPressIn={() => {
              navigation.navigate(MaterialReturnedPage.routeName);
            }}
          >
            退料
          </List.Item>
        )}
      </List>
      <List style={styles.verticallist}>
        {userStore.hasPermission('AerialMaterialMovement.permission') && (
          <List.Item
            arrow="horizontal"
            onPressIn={() => {
              navigation.navigate(AerialMaterialMovement.name);
            }}
          >
            移架
          </List.Item>
        )}
      </List>
    </Container>
  );
};

AerialMaterialWarehouseIndex.permission = 'RAerialMaterialWhse';
AerialMaterialWarehouseIndex.routeName = WhseManagementHomeRoute;
export default AerialMaterialWarehouseIndex;
